<template>
	<view class="NewsList">
		<view class="message_li" v-for="(item,index) in newsList" :key="index"
			@click="$jump('/pages/newsDetail/newsDetail?id=' + item.id)">
			<view class="left">
				<view class="title">
					<text v-if="item.title === '' || item.title === null">暂无标题</text>
					<text v-else>{{item.title}}</text>
				</view>
				<view class="time">
					<text v-if="item.addtime === null || item.addtime === ''">暂无添加时间</text>
					<text v-else>{{item.addtime | time}}</text>
				</view>
			</view>
			<view class="right">
				<image v-if="item.picture == ''" src="../static/img/33.png" mode=""></image>
				<image v-else-if="item.picture == null" src="../static/img/33.png"></image>
				<image v-else :src="$imgUrl + item.picture" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "NewsList",
		filters: {
			time(e) {
				return e.slice(0, e.indexOf(":") - 2)
				// if (self.list.length > 0) {
				// 	return e.slice(0, e.lastIndexOf(":"))
				// }else if (self.list.length == 0) {
				// 	return e
				// } 
			}
		},
		props: ["newsList"],
	}
</script>

<style lang="less">
	.NewsList {
		display: flex;
		flex-direction: column;

		.message_li {
			display: flex;
			justify-content: space-between;
			margin-bottom: 40rpx;

			.left {
				flex: 1;
				margin-right: 60rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.title {
					font-size: 30rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 3;
					/*想省略几行就写几*/
					-webkit-box-orient: vertical;
				}

				.time {
					font-size: 18rpx;
					color: #5e5e5e;
				}
			}

			.right {
				image {
					width: 250rpx;
					height: 160rpx;
					display: block;
				}
			}
		}
	}
</style>
